<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta
    name="viewport"
    content="width=device-width, initial-scale=1.0"
  >
  <meta
    http-equiv="X-UA-Compatible"
    content="ie=edge"
  >
  <title>Document</title>
  <style>
    .circle {
      width: 100px;
      height: 100px;
      background-color: #eee;
      margin: 100px auto;
      position: relative;
      border-radius: 50%;
    }

    .left,
    .right {
      width: 50px;
      height: 100px;
      /* background-color: #AFEEEE; */
      position: absolute;
      background: block;
      opacity: 0.5;
      overflow: hidden;
    }

    .left .left-circle,
    .right .right-circle {
      width: 50px;
      height: 100px;
      background: red;
      /* opacity: 0.5; */
      /* transition: all 0.5s; */
    }

    .left .left-circle {
      border-top-left-radius: 50px;
      border-bottom-left-radius: 50px;
      transform-origin: right center;
      transform: rotate(-180deg);
      animation: progress1 2s linear forwards;
      animation-delay: 2s;
    }

    /* .left:hover .left-circle {
      transform: rotate(0deg);
    } */

    .right .right-circle {
      border-top-right-radius: 50px;
      border-bottom-right-radius: 50px;
      transform-origin: left center;
      transform: rotate(-180deg);
      animation: progress2 2s linear forwards;
    }

    /* .right:hover .right-circle {
      transform: rotate(0deg);
    } */
    /* @keyframes progress1 {
      to {
        transform: rotate(0deg);
      }
    }

    @keyframes progress2 {
      to {
        transform: rotate(0deg);
      }
    } */

    .right {
      right: 0;
    }

    .inner {
      width: 80px;
      height: 80px;
      line-height: 80px;
      text-align: center;
      border-radius: 50%;
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      background-color: white;
      font-size: 25px;
    }
  </style>
</head>

<body>
  <div class="circle">
    <div class="left">
      <div class="left-circle">

      </div>
    </div>
    <div class="right">
      <div class="right-circle">

      </div>
    </div>
    <div class="inner">0%</div>
  </div>


  <script>
    let innerDom = document.querySelector('.inner');
    let leftCircle = document.querySelector('.left-circle');
    let rightCircle = document.querySelector('.right-circle');

    let timer = null;
    let loader = 0;
    let total = 1500;

    timer = setInterval(function () {
      let num = Number((loader / total) * 100).toFixed(1);
      let deg = Number((loader / total) * 360).toFixed(0);
      if (num > 100) {
        clearInterval(timer);
      } else {
        loader++;
        innerDom.textContent = num + "%";
        if (deg > 180) {
          leftCircle.style.transform = `rotate(${deg}deg)`;
        } else {
          rightCircle.style.transform = `rotate(-${180 - deg}deg)`;
        }
      }
    }, 1)
  </script>
</body>

</html>